class person:
    def __init__(self,high,weight):
        self.high = high
        self.weight = weight

p=person(180,140)
#p没有sex这个属性，则直接添加这个sex,如果有这个属性，则进行修改操作
# setattr(p,"sex","man")
# setattr(p,"high","181")
# print(p.sex)
# print(p.high)

#获取某个对象的属性，需要用print打印出来
# print(getattr(p,"high"))
# print(getattr(p,"weight"))
# print(getattr(p,"sex"))
#如果这个对象没有这个属性，则会直接报错AttributeError: 'person' object has no attribute 'home'
#print(getattr(p,"home"))
print(dir())
#print(dir("setattr方法.py"))